home *** CD-ROM | disk | FTP | other *** search
/ Emulator Universe CD / emulatoruniversecd1998.iso / CPC / Utils / CpcFile System / GETCPM.BAS < prev    next >
Encoding:
BASIC Source File  |  1994-07-14  |  2.2 KB  |  80 lines

  1. 10 PRINT TAB(50);CHR$(164);" Derik van Z\";CHR$(34);"utphen (jun94)"
  2. 20 PRINT "=== Dumping CP/M Tracks to a file ==="
  3. 30 PRINT 
  4. 40 SYMBOL AFTER 256
  5. 50 MEMORY &4000
  6. 60 DEFINT a-z
  7. 70 sector = &4000
  8. 80 track = &4001
  9. 90 buf = &4002
  10. 100 errno = &4004
  11. 101 'far address = &4005
  12. 102 'rsx name = &4008
  13. 110 readsec = &4100
  14. 120 POKE &4008,&84 ' RSX-Command for READ-SECTOR
  15. 130 READ progsize
  16. 140 FOR addr=readsec TO readsec+progsize-1
  17. 150 READ code
  18. 160 POKE addr,code
  19. 170 NEXT
  20. 180 PRINT "Insert a CP/M Diskette and press a key"
  21. 190 WHILE INKEY$="":WEND
  22. 200 ptr=&5000
  23. 210 FOR t = 0 TO 1
  24. 220 FOR s = &41 TO &49 
  25. 230 PRINT USING "Track=#   Sector=\\"+CHR$(13);t;HEX$(s);
  26. 240 POKE sector,s
  27. 250 POKE track,t
  28. 260 POKE buf,ptr MOD 256
  29. 270 POKE buf+1,ptr \ 256
  30. 280 CALL readsec
  31. 290 IF PEEK(errno)>0 THEN PRINT "Something went wrong! ... Aborted!":END
  32. 300 ptr = ptr + 512
  33. 310 NEXT
  34. 320 NEXT
  35. 330 PRINT "Insert a Diskette to save the CP/M image and press a key"
  36. 340 WHILE INKEY$="":WEND
  37. 350 PRINT "Writing to SYSTEM.CPM"
  38. 360 SAVE "system.cpm",b,&5000,18*512
  39. 370 DATA 46 
  40. 380 DATA &21,&08,&40,&cd,&d4,&bc,&d2,&28,&40,&22,&05,&40,&79,&32,&07,&40
  41. 390 DATA &1e,&00,&21,&01,&40,&56,&21,&00,&40,&4e,&2a,&02,&40,&df,&05,&40
  42. 400 DATA &d2,&28,&40,&af,&32,&04,&40,&c9,&3e,&01,&32,&04,&40,&c9
  43. 405 '
  44. 410 ' The MC program is the following:
  45. 420 ' 
  46. 430 ' org       &4000
  47. 440 ' sector:   db      0
  48. 450 ' track:    db      0
  49. 460 ' mem:      dw      0
  50. 470 ' errno:    db      0
  51. 480 ' faraddr:  dw      0
  52. 490 '           db      0
  53. 500 ' name:     db      &84
  54. 510 ' 
  55. 520 ' kl-find-command = &BCD4
  56. 530 ' 
  57. 540 ' org       &4100
  58. 550 ' 21 08 40  ld      hl,name
  59. 560 ' CD D4 BC  call    kl-find-command
  60. 570 ' D2 28 40  jp      nc,error
  61. 580 ' 22 05 40  ld      (faraddr),hl
  62. 590 ' 79        ld      a,c
  63. 600 ' 32 07 40  ld      (faraddr+2),a
  64. 610 ' 1E 00     ld      e,0
  65. 620 ' 21 01 40  ld      hl,track
  66. 630 ' 56        ld      d,(hl)
  67. 640 ' 21 00 40  ld      hl,sector
  68. 650 ' 4E        ld      c,(hl)
  69. 660 ' 2A 02 40  ld      hl,(mem)
  70. 670 ' DF        rst     3
  71. 680 ' 05 40     dw      faraddr
  72. 690 ' D2 28 40  jp      nc,error
  73. 700 ' AF        xor     a
  74. 710 ' 32 04 40  ld      (errno),a
  75. 720 ' C9        ret
  76. 730 ' error:
  77. 740 ' 3E 01     ld      a,1
  78. 750 ' 32 04 40  ld      (errno),a
  79. 760 ' C9        ret 
  80.